package com.samphanie.common.constants;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author ZSY
 * @email 1451691457@qq.com
 */
public interface SystemConstants {

    Long ROOT_VALUE = 0L;

    Integer STATUS_DISABLE_VALUE = 0;
    Integer STATUS_NORMAL_VALUE = 1;

    String DEFAULT_EMAIL_ADDRESS = "1451691457@qq.com";
    String DEFAULT_USER_PASSWORD = "123456";

    String PROBLEM_BASE_URI = "https://www.auiucloud.com";
    // ---- 正则表达式相关 ----
    String PATTERN_MOBILE = "^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\\d{8}$";
    String PATTERN_USERNAME = "^[a-z0-9_-]{3,50}$";
    String PATTERN_ROLE_NAME = "^[a-zA-Z0-9_]{3,50}$";

    // 后台管理接口路径匹配
    String ADMIN_URL_PATTERN = "/admin/**";

    Long SUPER_ADMIN = 1L;
    String SUPER_ADMIN_NAME = "SUPER_ADMIN";
    // ---- 授权相关 ----
    String JWT_TOKEN_PREFIX = "Bearer ";
    String JWT_TOKEN_HEADER = "Authorization";

    // ---- Redis缓存权限规则key 缓存相关 ----
    String CACHE_MFA = "cacheMfa";
    String ROOT_ROLE_CODE = "ROLE_SUPER_ADMIN";
    String RESOURCE_ROLES_MAP_KEY = "auth:resourceRolesMap";
    String PERMISSION_ROLES_KEY = "auth:permission:roles";
    String URL_PERM_ROLES_KEY = "system:permission:url_perm_roles:";
    String BTN_PERM_ROLES_KEY = "system:permission:btn_perm_roles:";
    String ALL_BTN_PERMISSION = "*:*:*";
    // JWT存储权限属性
    String AUTHORITY_CLAIM_NAME = "authorities";
    String ROLE_PREFIX = "ROLE_";
    String AUTHORITY_USER = "USER";
    String AUTHORITY_STAFF = "STAFF";
    String AUTHORITY_MANAGER = "MANAGER";
    String AUTHORITY_ADMIN = "ADMIN";
    String ROLE_USER = ROLE_PREFIX + AUTHORITY_USER;
    String ROLE_STAFF = ROLE_PREFIX + AUTHORITY_STAFF;
    String ROLE_MANAGER = ROLE_PREFIX + AUTHORITY_MANAGER;
    String ROLE_ADMIN = ROLE_PREFIX + AUTHORITY_ADMIN;
    String AUTHORITY_USER_ADMIN = "USER_ADMIN";
    String AUTHORITY_USER_UPDATE = "USER_UPDATE";
    String AUTHORITY_USER_CREATE = "USER_CREATE";
    String AUTHORITY_USER_READ = "USER_READ";

    /*** 当前页码 */
    String PAGE = "current";
    /*** 每页显示记录数 */
    String LIMIT = "pageSize";
    /*** 排序字段 */
    String ORDER_FIELD = "sidx";
    /*** 排序方式 */
    String ORDER = "order";
    /*** 升序 */
    String ASC = "asc";
    /*** 降序 */
    String DESC = "desc";

    /*** 禁用的用户 */
    String USER_BLACKLIST_PREFIX = "user:blacklist:";
    /*** token黑名单 */
    String TOKEN_BLACKLIST_PREFIX = "auth:token:blacklist:";
    // 仅支持字母、数字、下划线、空格、逗号、小数点（支持多个字段排序
    String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+";

    String ALI_OSS_CONFIG_REDIS_KEY = "ali";
    /*** 云存储配置KEY */
    String CLOUD_STORAGE_CONFIG_KEY = "CLOUD_STORAGE_CONFIG_KEY";
    /*** 自定义client表名 */
    String CLIENT_TABLE = "oauth_client_details";

    String GEN_TABLE_CONFIG_KEY = "GEN_TABLE_CONFIG_KEY";
    String SMS_TEMPLATE_KEY = "SMS_TEMPLATE_KEY";
    /**
     * 验证码缓存key
     */
    String CAPTCHA_KEY = "code:image:";
    String SMS_CODE_KEY = "code:sms:";
    String DEVICE_KEY = "deviceId";

}
